'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1539504147337_3245';

  // add your config here
  config.middleware = ['publicHandle'];

  config.view = {
    mapping: {
      '.pug': 'pug',
    },
    defaultExtension: '.pug',
  };

  // 安全插件
  config.security= {
    csrf: {
      enable: false,
      },
  }

  config.sessionRedis = {
    key: "EGG_SESSION",
    maxAge: 24 * 3600 * 1000, // 1 天
    httpOnly: true,
    encrypt: false
  };

  config.onerror = {
    // 线上页面发生异常时，重定向到这个页面上
    errorPageUrl: 'error.pug',
  };

  config.cluster = {
    listen: {
      port: 8008,
      hostname: '0.0.0.0',
      // path: '/var/run/egg.sock',
    }
  }

  return config;
};
